package com.ivo.sec;

import com.ivo.sys.user.User;

/**
 * 
 *
 * @author Minkey Wang
 * @version 2017年7月12日
 */
public class SessionLocal {
	private static ThreadLocal<User> threadLocal = new ThreadLocal<User>();

    /**
     * 设置用户信息
     * 
     * @param user
     */
    public static void setUser(User user){
    	threadLocal.set( user );
    }

    /**
     * 获取登录用户信息
     * 
     * @return
     */
    public static User getUser(){
//        System.out.println( "当前线程：" + Thread.currentThread().getName() );
        return threadLocal.get();
    }
    
    
    public static void clear() {
        threadLocal.remove();
    }
}
